package com.rq.demo.net;


import com.rq.base.net.impl.UrlImpl;
import com.rq.demo.BuildConfig;

public class Constants {
    //    http://bcs-vehicle-app.bdia.com.cn:8088
    private static final String F_SYS_URL = "https://www.abc:8088";   // 正式地址
    private static final String F_BCS_URL = "https://www.abd:8088";   // 正式地址
    private static final String F_SYS_URL_TEST = "https://www.abctest:8088";   // 测试地址
    private static final String F_BCS_URL_TEST = "https://www.abdtest:8088";   // 测试地址

    public static final boolean useDebug = true;

    public static final String SYS_URL = BuildConfig.DEBUG || useDebug ? F_SYS_URL_TEST : F_SYS_URL;   // 服务1
    public static final String BCS_URL = BuildConfig.DEBUG || useDebug ? F_BCS_URL_TEST : F_BCS_URL;   // 服务2
    public static final String DEFAULT_PORT = null;

    public static final String loge = "http";

    public enum NET_CODE implements UrlImpl {

        test(SYS_URL + "/trace/parkdaytrace/queryUserBindCarlist"),
        testPOST(BCS_URL + "trace/memberCar/bindMemberCarWx"),
        ;

        String port = DEFAULT_PORT, tag;
        boolean skip = false;//跳过短间断控制
        boolean paramAppend = false;//参数拼接到url中

        NET_CODE(String all) {
            this.tag = all;
        }

        NET_CODE(String all, boolean skip) {
            this.tag = all;
            this.skip = skip;
        }

        NET_CODE(boolean skip, String all) {
            this.tag = all;
            this.paramAppend = skip;
        }

        NET_CODE(String all, String port) {
            this.tag = all;
            this.port = port;
        }

        @Override
        public String getFullUrl() {
            if (tag.startsWith("http")) {
                return tag;
            }
            if (port == null) {
                return SYS_URL + "/" + tag;
            } else {
                return SYS_URL + ":" + port + "/" + tag;
            }
        }

        Object object;

        public UrlImpl with(Object profit) {
            this.object = profit;
            return this;
        }

        @Override
        public Object getMore() {
            return object;
        }

        @Override
        public boolean skip() {
            return skip;
        }

        @Override
        public boolean paramAppend() {
            return paramAppend;
        }


        @Override
        public String getTag() {
            return tag;
        }
    }
}
